<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Promise中的then返回结果</title>
</head>

<body>
    <!--
        then方法指定的回调函数执行结果由其中的内容来决定
    -->
    <script>
        const p1 = new Promise((resolve, reject) => {
            resolve('ok');
        })
        const result = p1.then(value => {
            //console.log(value);
            // return value;
            return new Promise((resolve, reject) => {
                //resolve('success');
                reject('error');
            })
        }, reason => {
            console.log(reason);
        })
        console.log(result);
    </script>
</body>

</html>